package com.chaoyong.higo.view;


import com.chaoyong.higo.R;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
/**
 * title 包括左右按钮和标题、图标
 * @author Johnson
 *
 */

public class TitleView extends LinearLayout {

	private TextView view_title_tx,view_right_tx;
	private ImageButton view_left_back,view_right_img;
	private ImageView view_title_img;
	private RelativeLayout view_title_lay;
	public TitleView(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}
	
	public TitleView(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
		LayoutInflater.from(context).inflate(R.layout.view_title, this, true); 
		view_title_tx=(TextView) findViewById(R.id.view_title_tx);
		view_left_back=(ImageButton) findViewById(R.id.view_left_back);
		view_title_img=(ImageView) findViewById(R.id.view_title_img);
		view_title_lay=(RelativeLayout) findViewById(R.id.view_title_lay);
		view_right_img=(ImageButton) findViewById(R.id.view_right_img);
	}
	//设置标头颜色
	public void setTitleBack(int color)
	{
		view_title_lay.setBackgroundColor(color);
	}
	//设置标头
	public void setTitleText(String str,int color)
	{
		view_title_tx.setText(str);
		view_title_tx.setTextColor(color);
	}
	//设置标题的图片路径
	public void setTitleImage(int str)
	{
		view_title_img.setImageResource(str);
	}
	//button设置左边按钮监听
	public void setonLeftClinck(View.OnClickListener listener) {
		view_left_back.setOnClickListener(listener);
	}
	//设置左边的图片路径
	public void setLeftImage(int str)
	{
		view_left_back.setImageResource(str);
	}
	//button设置右边按钮监听
	public void setonRightClinck(View.OnClickListener listener) {
		view_right_img.setOnClickListener(listener);
	}
	//设置右边的图片路径
	public void setRightImage(int str)
	{
		view_right_img.setImageResource(str);
	}
	
}
